.. _lineitemtolineitem: Set lineitem field from lineitem field expression ================================================= :superscript:`Workflowtaskslineitemtolineitem` .. image:: ../../_images/lineitemtolineitem/lineitemtolineitem_001.png :class: with-shadow :width: 400px :alt: workflow task editing .. image:: ../../_images/lineitemtolineitem/lineitemtolineitem_002.png :class: with-shadow :width: 400px :alt: workflow task editing | This workflow task allows you to define an expression with functions and lineitem fields and assign the result to a lineitem field. | The task is only for inventory modules: Quotes, Sales Orders, Invoices, and so on. | The task form allows you to define an expression of formulas and lineitem field names to produce a value to be inserted into a target lineitem field. There is a pop-up window with all available functions and fields. | It is very important to remember, for complex expressions, that every function and sub-expression must be enclosed in parentheses. ============================= Calculated value (expression) ============================= Let's see in detail Functions --------- * :guilabel:`concat(fieldA, fieldB, ...)`: concatenates fields separated by commas. You can also insert a function in place of the field or a string * :guilabel:`time_diffdays([datefieldA], datefieldB)`: calculates the difference, in days, between dates contained in datefieldA and datefieldB. Parameter “datefieldA” is optional, if omitted the reference date is the execution date * :guilabel:`time_diff([datefieldA], datefieldB)`: calculates the difference, in seconds, between dates contained in datefieldA and datefieldB. Parameter “datefieldA” is optional, if omitted the reference date is the execution date * :guilabel:`add_days([datefield], days)`: adds a number of days (days) to the date contained in the datefield field. Parameter “datefield” is optional, if omitted the reference date is the execution date * :guilabel:`sub_days([datefield], days)`: subtracts a number of days (days) from the date contained in the datefield field. Parameter “datefield” is optional, if omitted the reference date is the execution date * :guilabel:`add_time([timefield], minutes)`: adds a number of minutes (minutes) to the data contained in the datefield field. It returns only time part. Parameter “timefield” is optional, if omitted reference date is the execution time * :guilabel:`add_time_wdate([timefield], minutes)`: adds a number of minutes (minutes) to the data contained in the datefield field. It returns date and time part. Parameter “timefield” is optional, if omitted reference date is the execution time * :guilabel:`sub_time([timefield], minutes)`: subtracts a number of minutes (minutes) from the date contained in the datefield field. It returns only time part. Parameter “timefield” is optional, if omitted reference date is the execution time * :guilabel:`sub_time_wdate([timefield], minutes)`: subtracts a number of minutes (minutes) from the date contained in the datefield field. It returns date and time part. Parameter “timefield” is optional, if omitted reference date is the execution time * :guilabel:`get_datetime('Y-m-d H:i:s', [timefield])`: the current date-time formatted by PHP rules https://www.php.net/manual/en/datetime.format.php * :guilabel:`Today`: the date in which the task is executed * :guilabel:`Tomorrow`: date for the day following the execution of the task * :guilabel:`Yesterday`: the date of the day preceding the execution of the task * :guilabel:`intval(field)`: the integer number of the value contained in the field (also string) * :guilabel:`floatval(field)`: the decimal number of the value contained in the field (also string) * :guilabel:`integerformat(field)`: formats an integer number in the user format * :guilabel:`floatformat(field)`: formats a decimal number in the user format * :guilabel:`dateformat(field)`: formats, in the user format, the date contained in the field * :guilabel:`timeformat(field)`: formats a time value in the user format * :guilabel:`daytimeformat(field)`: formats “date time” value in the user format * :guilabel:`boolean('true'|'false')`: returns a boolean value 'true' or 'false' * :guilabel:`currencyformat(field)`: format the currency value and add currency symbol Specials -------- * :guilabel:`Currency symbol`: inserts the currency symbol * :guilabel:`Currency name`: inserts the currency name (eg EURO) * :guilabel:`Currency code`: inserts the currency code (eg EUR) * :guilabel:`Double quotes`: inserts the double quotes (") * :guilabel:`Single quote`: inserts the single quote (') * :guilabel:`HTML break`: inserts a HTML break for the WYSIWYG * :guilabel:`Text new line`: inserts a new line for textarea * :guilabel:`If ... Then ... Else`: inserts a conditional statement :code:`If (condition) then expression else expression end`. The condition :code:`If (condition)` can be a camparison of two expressions with operators: :code:`==, <, <=, >, >=` Fields ------ The available fields are all fields configured for the inventory module ======================= Target: lineitems field ======================= The target field where the expression result will be saved. ============= Entity filter ============= | Allows you to select a filter, previously created, of the module you are assigning the task. | This filter allows you to apply further filtering, in addition to the one already available in the workflow, to filter the records on which to perform the task. ==================== Lineitem type filter ==================== | Allows you to filter the lineitems on which to execute the task. | The filter is defined in the lineitem type module, :guilabel:`Products` / :guilabel:`Services`. | Lineitems not selected by the filter will remain unchanged. ================ Lineitems filter ================ | As for :guilabel:`Lineitem type filter`, this filter also defines which lineitems the task is applied to. | The difference is that, in this case, the filter (max 3 **AND** conditions) works on the values of the lineitem fields. ============ Add new rule ============ Allows you to add one or more rules to create tasks for assignments to different entity fields in the same workflow task.